import request from '@/utils/request'

// 获取角色列表
export const getRoles = () => request.get('roles')

// 删除角色指定权限
export const removeRightById = (roleId, rightId) => request.delete(`roles/${roleId}/rights/${rightId}`)

// 添加角色
export const addRole = role => request.post('roles', role)

// 删除角色
export const deleteRole = roleId => request.delete(`roles/${roleId}`)

// 根据角色ID获取角色信息
export const getRoleInfoById = roleId => request.get(`roles/${roleId}`)

// 修改角色信息
export const modifyRoleInfo = (roleId, role) => request.put(`roles/${roleId}`, role)

// 保存角色的授权信息
export const saveRoleRightsInfo = (roleId, rids) => request.post(`roles/${roleId}/rights`, { rids })
